import { RouteObject } from "react-router-dom";

import BasicLayout from "@/layout";
import Login from "@/views/login";

// 动态导入
const modList: RouteObject[] = [];
const context = require.context("./modules", false, /\.tsx$/);
context.keys().forEach((id) => {
  const mod = context(id).default;
  modList.push(mod);
});

export const menuRoutes = [...modList];

export const routes = [
  ...menuRoutes,
  {
    key: "/",
    label: "",
    path: "/",
    element: <BasicLayout />,
  },
  {
    key: "/login",
    label: "",
    path: "/login",
    element: <Login />,
  },
];
